<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="PreguntaCreateDlg" widgetVar="PreguntaCreateDialog" modal="true" resizable="false" appendTo="@(body)" header="#{appBundle.CreatePreguntaTitle}" closeOnEscape="true">

            <h:form id="PreguntaCreateForm">

                <h:panelGroup id="display" rendered="#{preguntaController.selected != null}">
                    <p:panelGrid columns="2" columnClasses="column">

                        <p:outputLabel value="#{appBundle.CreatePreguntaLabel_treCodigo}" for="treCodigo" />
                        <p:selectOneMenu id="treCodigo" value="#{preguntaController.selected.treCodigo}">
                            <f:selectItems value="#{tipRespController.items}" var="itemTRes" itemValue="#{itemTRes.treCodigo}" itemLabel="#{itemTRes.treDescri}"/>
                        </p:selectOneMenu>

                        <p:outputLabel value="#{appBundle.CreatePreguntaLabel_servId}" for="servId" />
                        <p:selectOneMenu id="servId" value="#{preguntaController.selected.servId}">
                            <f:selectItems value="#{servicioController.items}" var="itemServ" itemValue="#{itemServ.servId}" itemLabel="#{itemServ.servDeno}"/>
                        </p:selectOneMenu>

                        <p:outputLabel value="#{appBundle.CreatePreguntaLabel_encCodigo}" for="encCodigo" />
                        <p:selectOneMenu id="encCodigo" value="#{preguntaController.selected.encCodigo}">
                            <f:selectItems value="#{encuestaController.items}" var="itemEnc" itemValue="#{itemEnc.encCodigo}" itemLabel="#{itemEnc.encDescri}"/>
                        </p:selectOneMenu>

                        <p:outputLabel value="#{appBundle.CreatePreguntaLabel_prePregunta}" for="prePregunta" />
                        <p:inputTextarea rows="4" cols="30" id="prePregunta" value="#{preguntaController.selected.prePregunta}" title="#{appBundle.CreatePreguntaTitle_prePregunta}" />
                      
                        <p:outputLabel value="Pregunta Libre:" for="preLibre" />
                        <p:selectBooleanCheckbox id="preLibre" value="#{preguntaController.selected.preLibre}" />

                        <p:outputLabel value="Pregunta Obligatoria:" for="preOblig" />
                        <p:selectBooleanCheckbox id="preOblig" value="#{preguntaController.selected.preOblig}" />
                    </p:panelGrid>
                    <p:commandButton actionListener="#{preguntaController.saveNew}" value="#{appBundle.Save}" update="display,:PreguntaListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,PreguntaCreateDialog);">
                        <p:confirm header="#{appBundle.ConfirmationHeader}" message="#{appBundle.ConfirmCreateMessage}" icon="ui-icon-alert"/>
                    </p:commandButton>

                    <p:commandButton value="#{appBundle.Cancel}" onclick="PreguntaCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
